<?php
namespace App\Controllers;
use App\Jobs\SmsJob;
use App\Models\FeedbackModel;
use App\Requests\CheckVersionRequest;
use App\Services\AppService;
use Framework\BaseController;
use Framework\ModelEncryptionTrait;
use Illuminate\Http\Request;

class AppController extends BaseController
{
    use ModelEncryptionTrait;


    public function checkVersion(CheckVersionRequest $request , AppService $service)
    {

        $type = $request->type();
        $version = $request->version();

        $info = $service->getVersionInfo($type, $version);
        $this->retSuccess($info);
    }


    public function app_info()
    {
        $app_info = app(AppService::class)->app_open();
        $this->retSuccess(compact('app_info'));
    }

    public function feedback(Request $request)
    {
        $content = $request->input('content');
        $phone = $request->input('phone');
        $image = $request->input('image');
        $model = new FeedbackModel();
        $model->content = $content;
        $model->phone = $phone;
        $model->image = $image;
        $model->saveOrFail();
        $this->retSuccess(true);
    }




}
